Release 10.1A: OpenEdge Development:
Progress 4GL Handbook
Running a subprocedure
To run a procedure from within another 4GL procedure, you use the
RUNstatement. Like theCOMPILEstatement, theRUNstatement has a lot of options, some of which you’ll learn about in later chapters. For now a very simple form of the statement will do:
If you are running a procedure file like your
h-CustSample.p, then the convention is to include the.pextension in the procedure name. For example, if you bring up a new Procedure Window again, you can enter this statement to run the sample procedure you’ve been working on, then press F2:
![]()
This is a little different than just pressing the F2 key in the procedure window where you’re editing
h-CustSample.p. When you press F2 or select CompileRun you are compiling and running the current contents of the Procedure Editor window, which might be different from what you have saved to a named file. You can compile and run a procedure without giving it a name at all. Indeed, that’s what you just did: you created a procedure containing a single
RUNstatement, and then simply compiled and executed it by pressing F2. This temporary procedure in turn ran the named procedure you had already saved and compiled.Now, why did you put the
.pextension on theRUNstatement when you have already saved a compiled.rversion of the file out to your directory? When you write a 4GLRUNstatement with a.pextension on the procedure name, Progress always looks first for a compiled file of the same name, but with the.rextension. If it finds it, it executes it. If it doesn’t, it passes the source file to the Progress compiler, which compiles it on the fly and then executes it. In this way, your application can be a mix of compiled and uncompiled procedures while you’re developing it. If you always use the.pextension in yourRUNstatements, then your procedures are always found and executed whether they’ve been compiled or not. By contrast, if you specify the.rextension in aRUNstatement, then Progress looks for only the compiled.rfile, and theRUNfails if it isn’t found.
|
Copyright © 2005 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095 |